Skip to content

feat: [OpenAI] Release OpenAI Responses API #910

Open
n-o-u-r-h-a-n wants to merge 52 commits into
mainfrom
release-responses-api-beta
Open

feat: [OpenAI] Release OpenAI Responses API #910
n-o-u-r-h-a-n wants to merge 52 commits into
mainfrom
release-responses-api-beta

Conversation

@n-o-u-r-h-a-n

@n-o-u-r-h-a-n n-o-u-r-h-a-n commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Context

AI/ai-sdk-java-backlog#390.

Stability concerns about AI Proxy are tackled now supporting new endpoints and documenting Responses API.

Feature scope:

  • Supported retrieve, delete and cancel response by id endpoints due to being tested manually in Bruno and supported by .md file from Vikash.
  • Added e2e tests and integration tests for new endpoints as well as controller methods.

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Aligned changes with the JavaScript SDK
  • Documentation updated
  • Release notes updated

rpanackal and others added 30 commits April 2, 2026 11:52
- Streaming no fully enabled
* Minimal new module setup including spec

* Generation partial-success

* Remove examples

* Successfully filter by path

* Attach spec filter command

* Initial setup

* Successful PoC with OpenAI Models

* Version 1

* Stable api

* Change class name

* Add tests

* fix dependency analyse issues

* Initial draft untested

* Second draft
- Streaming no fully enabled

* Successful E2E

* Streaming initial draft

* Streaming E2E with chat completion

* isStreaming check simplified

* Cleanup PoC and rename module

* Reduce Javadoc verbosity

* Restrict to `/responses` api

* Cleanup comments

* Charles review suggestions

* Charles review - round 2 suggestions

* Add dependency

* Mark openai dependency optional and new client `@Beta`

* Cleanup and no throw on missing model

* pmd

* Responses API complete

* ChatCompletionCreateParams throws without model. Needs rethink client API creation forModel

* Cleanup and close with test documenting limitation

* First draft responses only

* jacoco limits

* Remove ResponseService wrapper since remote API behaviour changed
@n-o-u-r-h-a-n

Copy link
Copy Markdown
Contributor Author
  1. Documentation is still in progress being updated.
  2. The 3 newly supported endpoints were not added to the index page as they are not compatible because they need a real id to be able to retrieve, cancel or delete this response.

@Jonas-Isr Jonas-Isr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good overall! I had a few comments and one question:

Would it make sense to also test the other features mentioned in the md file, like reasoning effort, background mode etc in the e2e tests? Then we would also have code examples for those features that we could put into the documentation.

* <p>This class provides factory methods that return fully configured OpenAI SDK clients using SAP
* Cloud SDK's Apache HttpClient with automatic OAuth token refresh.
*
* @since 1.19.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Minor)

Maybe also elsewhere?

Suggested change
* @since 1.19.0
* @since 1.21.0

Comment on lines +38 to +44
@Test
void testCreateStreamingResponse() {
try (var stream = service.createStreamingResponse("What is the capital of France?")) {
stream.stream()
.forEach(
event -> {
assertThat(event.isValid()).isTrue();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run this test locally it fails for the assertion in line 44 😬

Comment on lines +44 to +47
Map.of(
"/responses", Set.of("POST"),
"/responses/[^/]+", Set.of("GET", "DELETE"),
"/responses/[^/]+/cancel", Set.of("POST"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Question)

Would not /responses/[^/]+ match everything that is matched by /responses/[^/]+/cancel? In that case we rely on the implicit ordering of the HashMap in lines 91 onward to find the correct entry. That would be dangerous I think.

Comment on lines +206 to +224
if (event.isCompleted()) {
final var completed = event.asCompleted().response();

final var usage = completed.usage().orElseThrow();
assertThat(usage.inputTokens()).isEqualTo(13L);
assertThat(usage.outputTokens()).isEqualTo(59L);
assertThat(usage.totalTokens()).isEqualTo(72L);

final var output = completed.output();
assertThat(output).isNotNull();
final var item1 = output.get(0);
assertThat(item1.isReasoning()).isTrue();
final var item2 = output.get(1);
assertThat(item2.isMessage()).isTrue();
assertThat(item2.asMessage().content()).isNotEmpty();
final ResponseOutputMessage.Content content = item2.asMessage().content().get(0);
assertThat(content.isOutputText()).isTrue();
assertThat(content.asOutputText().text()).contains("lemonade");
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Major)

The code inside this IF block is never reached (you can check in the debugger). Thus, these assertions are never checked.

Comment thread pom.xml
Comment on lines +261 to +265
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java-client-okhttp</artifactId>
<version>${openai-java.version}</version>
</dependency>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Question)

Is this dependency used somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants